package com.example.jeong.yuejian10.Activity;



import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.jeong.yuejian10.R;
import com.squareup.picasso.Picasso;

import static com.example.jeong.yuejian10.constant.Constant.PROCOURSE_PHOTO_URL;

//大师课堂详情页
public class ProCourseDetailActivity extends Activity {

    private ImageView copic;
    private TextView coinfo;
    private TextView coname;
    private ImageView back;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_procourse_detail);
        initViews();
        initEvent();
        getCourseDetail();
    }
    private void initViews(){
        copic = (ImageView) findViewById(R.id.course_pic);
        coinfo = (TextView) findViewById(R.id.course_info);
        coname = (TextView) findViewById(R.id.coursename);
        back = (ImageView) findViewById(R.id.back_prodetail);
    }
    private void initEvent(){
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }
    private void getCourseDetail(){

        Bundle bundle = this.getIntent().getExtras();
        String coName = bundle.getString("pc_name");
        String coInfo = bundle.getString("pc_info");
        String coPic = PROCOURSE_PHOTO_URL + bundle.getString("pc_pic");
        coname.setText(coName);
        coinfo.setText(coInfo);
        Picasso.with(this).load(coPic).into(copic);
    }

}

